<!-- HTML header for doxygen 1.8.9.1-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<meta name="robots" content="NOINDEX, NOFOLLOW" /> <!-- Prevent indexing by search engines -->
<title>Compute Library: CommandLineParser Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
  $(window).load(resizeHeight);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { init_search(); });
</script>
<script type="text/x-mathjax-config">
  MathJax.Hub.Config({
    extensions: ["tex2jax.js"],
    jax: ["input/TeX","output/HTML-CSS"],
});
</script><script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">Compute Library
   &#160;<span id="projectnumber">18.05</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.11 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.xhtml"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.xhtml"><span>Related&#160;Pages</span></a></li>
      <li><a href="namespaces.xhtml"><span>Namespaces</span></a></li>
      <li class="current"><a href="annotated.xhtml"><span>Data&#160;Structures</span></a></li>
      <li><a href="files.xhtml"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="annotated.xhtml"><span>Data&#160;Structures</span></a></li>
      <li><a href="classes.xhtml"><span>Data&#160;Structure&#160;Index</span></a></li>
      <li><a href="inherits.xhtml"><span>Class&#160;Hierarchy</span></a></li>
      <li><a href="functions.xhtml"><span>Data&#160;Fields</span></a></li>
    </ul>
  </div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('classarm__compute_1_1test_1_1framework_1_1_command_line_parser.xhtml','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a>  </div>
  <div class="headertitle">
<div class="title">CommandLineParser Class Reference<span class="mlabels"><span class="mlabel">final</span></span></div>  </div>
</div><!--header-->
<div class="contents">

<p>Class to parse command line arguments.  
 <a href="classarm__compute_1_1test_1_1framework_1_1_command_line_parser.xhtml#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="_command_line_parser_8h_source.xhtml">CommandLineParser.h</a>&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a169ae39f7c9da9fee21c577ae5d7954f"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classarm__compute_1_1test_1_1framework_1_1_command_line_parser.xhtml#a169ae39f7c9da9fee21c577ae5d7954f">CommandLineParser</a> ()=default</td></tr>
<tr class="memdesc:a169ae39f7c9da9fee21c577ae5d7954f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Default constructor.  <a href="#a169ae39f7c9da9fee21c577ae5d7954f">More...</a><br /></td></tr>
<tr class="separator:a169ae39f7c9da9fee21c577ae5d7954f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a533951910a8df4f26eac7e534a226c5f"><td class="memTemplParams" colspan="2">template&lt;typename T , typename... As&gt; </td></tr>
<tr class="memitem:a533951910a8df4f26eac7e534a226c5f"><td class="memTemplItemLeft" align="right" valign="top">T *&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="classarm__compute_1_1test_1_1framework_1_1_command_line_parser.xhtml#a533951910a8df4f26eac7e534a226c5f">add_option</a> (const std::string &amp;name, As &amp;&amp;...args)</td></tr>
<tr class="memdesc:a533951910a8df4f26eac7e534a226c5f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Function to add a new option to the parser.  <a href="#a533951910a8df4f26eac7e534a226c5f">More...</a><br /></td></tr>
<tr class="separator:a533951910a8df4f26eac7e534a226c5f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a079cbecac60787502777460ef65491c0"><td class="memTemplParams" colspan="2">template&lt;typename T , typename... As&gt; </td></tr>
<tr class="memitem:a079cbecac60787502777460ef65491c0"><td class="memTemplItemLeft" align="right" valign="top">T *&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="classarm__compute_1_1test_1_1framework_1_1_command_line_parser.xhtml#a079cbecac60787502777460ef65491c0">add_positional_option</a> (As &amp;&amp;...args)</td></tr>
<tr class="memdesc:a079cbecac60787502777460ef65491c0"><td class="mdescLeft">&#160;</td><td class="mdescRight">Function to add a new positional argument to the parser.  <a href="#a079cbecac60787502777460ef65491c0">More...</a><br /></td></tr>
<tr class="separator:a079cbecac60787502777460ef65491c0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a66fa8f960eac1bf561ba2cb8be0cc58a"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classarm__compute_1_1test_1_1framework_1_1_command_line_parser.xhtml#a66fa8f960eac1bf561ba2cb8be0cc58a">parse</a> (int argc, char **argv)</td></tr>
<tr class="memdesc:a66fa8f960eac1bf561ba2cb8be0cc58a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Parses the command line arguments and updates the options accordingly.  <a href="#a66fa8f960eac1bf561ba2cb8be0cc58a">More...</a><br /></td></tr>
<tr class="separator:a66fa8f960eac1bf561ba2cb8be0cc58a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:afd5aa83cd390b855c74887fca8407e84"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classarm__compute_1_1test_1_1framework_1_1_command_line_parser.xhtml#afd5aa83cd390b855c74887fca8407e84">validate</a> () const </td></tr>
<tr class="memdesc:afd5aa83cd390b855c74887fca8407e84"><td class="mdescLeft">&#160;</td><td class="mdescRight">Validates the previously parsed command line arguments.  <a href="#afd5aa83cd390b855c74887fca8407e84">More...</a><br /></td></tr>
<tr class="separator:afd5aa83cd390b855c74887fca8407e84"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a5ff56e81c580d778a11ef91d5757be80"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classarm__compute_1_1test_1_1framework_1_1_command_line_parser.xhtml#a5ff56e81c580d778a11ef91d5757be80">print_help</a> (const std::string &amp;program_name) const </td></tr>
<tr class="memdesc:a5ff56e81c580d778a11ef91d5757be80"><td class="mdescLeft">&#160;</td><td class="mdescRight">Prints a help message for all configured options.  <a href="#a5ff56e81c580d778a11ef91d5757be80">More...</a><br /></td></tr>
<tr class="separator:a5ff56e81c580d778a11ef91d5757be80"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Class to parse command line arguments. </p>

<p>Definition at line <a class="el" href="_command_line_parser_8h_source.xhtml#l00043">43</a> of file <a class="el" href="_command_line_parser_8h_source.xhtml">CommandLineParser.h</a>.</p>
</div><h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a class="anchor" id="a169ae39f7c9da9fee21c577ae5d7954f"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classarm__compute_1_1test_1_1framework_1_1_command_line_parser.xhtml">CommandLineParser</a> </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">default</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Default constructor. </p>

</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a class="anchor" id="a533951910a8df4f26eac7e534a226c5f"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">T * add_option </td>
          <td>(</td>
          <td class="paramtype">const std::string &amp;&#160;</td>
          <td class="paramname"><em>name</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">As &amp;&amp;...&#160;</td>
          <td class="paramname"><em>args</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Function to add a new option to the parser. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">name</td><td>Name of the option. Will be available under &ndash;name=VALUE. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">args</td><td><a class="el" href="classarm__compute_1_1test_1_1framework_1_1_option.xhtml" title="Abstract base class for a command line option. ">Option</a> specific configuration arguments.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Pointer to the option. The option is owned by the parser. </dd></dl>

<p>Definition at line <a class="el" href="_command_line_parser_8h_source.xhtml#l00102">102</a> of file <a class="el" href="_command_line_parser_8h_source.xhtml">CommandLineParser.h</a>.</p>

<p>Referenced by <a class="el" href="_common_options_8cpp_source.xhtml#l00037">CommonOptions::CommonOptions()</a>, and <a class="el" href="main_8cpp_source.xhtml#l00063">main()</a>.</p>
<div class="fragment"><div class="line"><a name="l00103"></a><span class="lineno">  103</span>&#160;{</div><div class="line"><a name="l00104"></a><span class="lineno">  104</span>&#160;    <span class="keyword">auto</span> result = _options.emplace(name, support::cpp14::make_unique&lt;T&gt;(name, std::forward&lt;As&gt;(args)...));</div><div class="line"><a name="l00105"></a><span class="lineno">  105</span>&#160;    <span class="keywordflow">return</span> <span class="keyword">static_cast&lt;</span>T *<span class="keyword">&gt;</span>(result.first-&gt;second.get());</div><div class="line"><a name="l00106"></a><span class="lineno">  106</span>&#160;}</div></div><!-- fragment -->
</div>
</div>
<a class="anchor" id="a079cbecac60787502777460ef65491c0"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">T * add_positional_option </td>
          <td>(</td>
          <td class="paramtype">As &amp;&amp;...&#160;</td>
          <td class="paramname"><em>args</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Function to add a new positional argument to the parser. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">args</td><td><a class="el" href="classarm__compute_1_1test_1_1framework_1_1_option.xhtml" title="Abstract base class for a command line option. ">Option</a> specific configuration arguments.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Pointer to the option. The option is owned by the parser. </dd></dl>

<p>Definition at line <a class="el" href="_command_line_parser_8h_source.xhtml#l00109">109</a> of file <a class="el" href="_command_line_parser_8h_source.xhtml">CommandLineParser.h</a>.</p>

<p>Referenced by <a class="el" href="main_8cpp_source.xhtml#l00063">main()</a>.</p>
<div class="fragment"><div class="line"><a name="l00110"></a><span class="lineno">  110</span>&#160;{</div><div class="line"><a name="l00111"></a><span class="lineno">  111</span>&#160;    _positional_options.emplace_back(support::cpp14::make_unique&lt;T&gt;(std::forward&lt;As&gt;(args)...));</div><div class="line"><a name="l00112"></a><span class="lineno">  112</span>&#160;    <span class="keywordflow">return</span> <span class="keyword">static_cast&lt;</span>T *<span class="keyword">&gt;</span>(_positional_options.back().get());</div><div class="line"><a name="l00113"></a><span class="lineno">  113</span>&#160;}</div></div><!-- fragment -->
</div>
</div>
<a class="anchor" id="a66fa8f960eac1bf561ba2cb8be0cc58a"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void parse </td>
          <td>(</td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>argc</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">char **&#160;</td>
          <td class="paramname"><em>argv</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Parses the command line arguments and updates the options accordingly. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">argc</td><td>Number of arguments. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">argv</td><td>Arguments. </td></tr>
  </table>
  </dd>
</dl>

<p>Definition at line <a class="el" href="_command_line_parser_8cpp_source.xhtml#l00035">35</a> of file <a class="el" href="_command_line_parser_8cpp_source.xhtml">CommandLineParser.cpp</a>.</p>

<p>References <a class="el" href="tests_2framework_2_utils_8h_source.xhtml#l00147">arm_compute::test::tolower()</a>.</p>

<p>Referenced by <a class="el" href="main_8cpp_source.xhtml#l00063">main()</a>.</p>
<div class="fragment"><div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160;{</div><div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;    <span class="keyword">const</span> std::regex option_regex{ <span class="stringliteral">&quot;--((?:no-)?)([^=]+)(?:=(.*))?&quot;</span> };</div><div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;</div><div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;    <span class="keyword">const</span> <span class="keyword">auto</span> set_option = [&amp;](<span class="keyword">const</span> std::string &amp; option, <span class="keyword">const</span> std::string &amp; name, <span class="keyword">const</span> std::string &amp; value)</div><div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;    {</div><div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;        <span class="keywordflow">if</span>(_options.find(name) == _options.end())</div><div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160;        {</div><div class="line"><a name="l00043"></a><span class="lineno">   43</span>&#160;            _unknown_options.push_back(option);</div><div class="line"><a name="l00044"></a><span class="lineno">   44</span>&#160;            <span class="keywordflow">return</span>;</div><div class="line"><a name="l00045"></a><span class="lineno">   45</span>&#160;        }</div><div class="line"><a name="l00046"></a><span class="lineno">   46</span>&#160;</div><div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160;        <span class="keyword">const</span> <span class="keywordtype">bool</span> success = _options[name]-&gt;parse(value);</div><div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;</div><div class="line"><a name="l00049"></a><span class="lineno">   49</span>&#160;        <span class="keywordflow">if</span>(!success)</div><div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160;        {</div><div class="line"><a name="l00051"></a><span class="lineno">   51</span>&#160;            _invalid_options.push_back(option);</div><div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160;        }</div><div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160;    };</div><div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160;</div><div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160;    <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> positional_index = 0;</div><div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160;</div><div class="line"><a name="l00057"></a><span class="lineno">   57</span>&#160;    <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i = 1; i &lt; argc; ++i)</div><div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;    {</div><div class="line"><a name="l00059"></a><span class="lineno">   59</span>&#160;        std::string mixed_case_opt{ argv[i] };</div><div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160;        <span class="keywordtype">int</span>         equal_sign = mixed_case_opt.find(<span class="charliteral">&#39;=&#39;</span>);</div><div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160;        <span class="keywordtype">int</span>         pos        = (equal_sign == -1) ? strlen(argv[i]) : equal_sign;</div><div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160;</div><div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;        <span class="keyword">const</span> std::string option = <a class="code" href="namespacearm__compute_1_1test.xhtml#a5b67cbf475b1e1d3bec9b0b937fdafac">tolower</a>(mixed_case_opt.substr(0, pos)) + mixed_case_opt.substr(pos);</div><div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160;        std::smatch       option_matches;</div><div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160;</div><div class="line"><a name="l00066"></a><span class="lineno">   66</span>&#160;        <span class="keywordflow">if</span>(std::regex_match(option, option_matches, option_regex))</div><div class="line"><a name="l00067"></a><span class="lineno">   67</span>&#160;        {</div><div class="line"><a name="l00068"></a><span class="lineno">   68</span>&#160;            <span class="comment">// Boolean option</span></div><div class="line"><a name="l00069"></a><span class="lineno">   69</span>&#160;            <span class="keywordflow">if</span>(option_matches.str(3).empty())</div><div class="line"><a name="l00070"></a><span class="lineno">   70</span>&#160;            {</div><div class="line"><a name="l00071"></a><span class="lineno">   71</span>&#160;                set_option(option, option_matches.str(2), option_matches.str(1).empty() ? <span class="stringliteral">&quot;true&quot;</span> : <span class="stringliteral">&quot;false&quot;</span>);</div><div class="line"><a name="l00072"></a><span class="lineno">   72</span>&#160;            }</div><div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160;            <span class="keywordflow">else</span></div><div class="line"><a name="l00074"></a><span class="lineno">   74</span>&#160;            {</div><div class="line"><a name="l00075"></a><span class="lineno">   75</span>&#160;                <span class="comment">// Can&#39;t have &quot;no-&quot; and a value</span></div><div class="line"><a name="l00076"></a><span class="lineno">   76</span>&#160;                <span class="keywordflow">if</span>(!option_matches.str(1).empty())</div><div class="line"><a name="l00077"></a><span class="lineno">   77</span>&#160;                {</div><div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160;                    _invalid_options.emplace_back(option);</div><div class="line"><a name="l00079"></a><span class="lineno">   79</span>&#160;                }</div><div class="line"><a name="l00080"></a><span class="lineno">   80</span>&#160;                <span class="keywordflow">else</span></div><div class="line"><a name="l00081"></a><span class="lineno">   81</span>&#160;                {</div><div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160;                    set_option(option, option_matches.str(2), option_matches.str(3));</div><div class="line"><a name="l00083"></a><span class="lineno">   83</span>&#160;                }</div><div class="line"><a name="l00084"></a><span class="lineno">   84</span>&#160;            }</div><div class="line"><a name="l00085"></a><span class="lineno">   85</span>&#160;        }</div><div class="line"><a name="l00086"></a><span class="lineno">   86</span>&#160;        <span class="keywordflow">else</span></div><div class="line"><a name="l00087"></a><span class="lineno">   87</span>&#160;        {</div><div class="line"><a name="l00088"></a><span class="lineno">   88</span>&#160;            <span class="keywordflow">if</span>(positional_index &gt;= _positional_options.size())</div><div class="line"><a name="l00089"></a><span class="lineno">   89</span>&#160;            {</div><div class="line"><a name="l00090"></a><span class="lineno">   90</span>&#160;                _invalid_options.push_back(mixed_case_opt);</div><div class="line"><a name="l00091"></a><span class="lineno">   91</span>&#160;            }</div><div class="line"><a name="l00092"></a><span class="lineno">   92</span>&#160;            <span class="keywordflow">else</span></div><div class="line"><a name="l00093"></a><span class="lineno">   93</span>&#160;            {</div><div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160;                _positional_options[positional_index]-&gt;parse(mixed_case_opt);</div><div class="line"><a name="l00095"></a><span class="lineno">   95</span>&#160;                ++positional_index;</div><div class="line"><a name="l00096"></a><span class="lineno">   96</span>&#160;            }</div><div class="line"><a name="l00097"></a><span class="lineno">   97</span>&#160;        }</div><div class="line"><a name="l00098"></a><span class="lineno">   98</span>&#160;    }</div><div class="line"><a name="l00099"></a><span class="lineno">   99</span>&#160;}</div><div class="ttc" id="namespacearm__compute_1_1test_xhtml_a5b67cbf475b1e1d3bec9b0b937fdafac"><div class="ttname"><a href="namespacearm__compute_1_1test.xhtml#a5b67cbf475b1e1d3bec9b0b937fdafac">arm_compute::test::tolower</a></div><div class="ttdeci">std::string tolower(std::string string)</div><div class="ttdoc">Convert string to lower case. </div><div class="ttdef"><b>Definition:</b> <a href="tests_2framework_2_utils_8h_source.xhtml#l00147">Utils.h:147</a></div></div>
</div><!-- fragment -->
</div>
</div>
<a class="anchor" id="a5ff56e81c580d778a11ef91d5757be80"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void print_help </td>
          <td>(</td>
          <td class="paramtype">const std::string &amp;&#160;</td>
          <td class="paramname"><em>program_name</em></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Prints a help message for all configured options. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">program_name</td><td>Name of the program to be used in the help message. </td></tr>
  </table>
  </dd>
</dl>

<p>Definition at line <a class="el" href="_command_line_parser_8cpp_source.xhtml#l00136">136</a> of file <a class="el" href="_command_line_parser_8cpp_source.xhtml">CommandLineParser.cpp</a>.</p>

<p>Referenced by <a class="el" href="main_8cpp_source.xhtml#l00063">main()</a>.</p>
<div class="fragment"><div class="line"><a name="l00137"></a><span class="lineno">  137</span>&#160;{</div><div class="line"><a name="l00138"></a><span class="lineno">  138</span>&#160;    std::cout &lt;&lt; <span class="stringliteral">&quot;usage: &quot;</span> &lt;&lt; program_name &lt;&lt; <span class="stringliteral">&quot; \n&quot;</span>;</div><div class="line"><a name="l00139"></a><span class="lineno">  139</span>&#160;</div><div class="line"><a name="l00140"></a><span class="lineno">  140</span>&#160;    <span class="keywordflow">for</span>(<span class="keyword">const</span> <span class="keyword">auto</span> &amp;option : _options)</div><div class="line"><a name="l00141"></a><span class="lineno">  141</span>&#160;    {</div><div class="line"><a name="l00142"></a><span class="lineno">  142</span>&#160;        std::cout &lt;&lt; option.second-&gt;help() &lt;&lt; <span class="stringliteral">&quot;\n&quot;</span>;</div><div class="line"><a name="l00143"></a><span class="lineno">  143</span>&#160;    }</div><div class="line"><a name="l00144"></a><span class="lineno">  144</span>&#160;</div><div class="line"><a name="l00145"></a><span class="lineno">  145</span>&#160;    <span class="keywordflow">for</span>(<span class="keyword">const</span> <span class="keyword">auto</span> &amp;option : _positional_options)</div><div class="line"><a name="l00146"></a><span class="lineno">  146</span>&#160;    {</div><div class="line"><a name="l00147"></a><span class="lineno">  147</span>&#160;        std::cout &lt;&lt; option-&gt;name() &lt;&lt; <span class="stringliteral">&quot;\n&quot;</span>;</div><div class="line"><a name="l00148"></a><span class="lineno">  148</span>&#160;    }</div><div class="line"><a name="l00149"></a><span class="lineno">  149</span>&#160;}</div></div><!-- fragment -->
</div>
</div>
<a class="anchor" id="afd5aa83cd390b855c74887fca8407e84"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool validate </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Validates the previously parsed command line arguments. </p>
<p>Validation fails if not all required options are provided. Additionally warnings are generated for options that have illegal values or unknown options.</p>
<dl class="section return"><dt>Returns</dt><dd>True if all required options have been provided. </dd></dl>

<p>Definition at line <a class="el" href="_command_line_parser_8cpp_source.xhtml#l00101">101</a> of file <a class="el" href="_command_line_parser_8cpp_source.xhtml">CommandLineParser.cpp</a>.</p>

<p>Referenced by <a class="el" href="main_8cpp_source.xhtml#l00063">main()</a>.</p>
<div class="fragment"><div class="line"><a name="l00102"></a><span class="lineno">  102</span>&#160;{</div><div class="line"><a name="l00103"></a><span class="lineno">  103</span>&#160;    <span class="keywordtype">bool</span> is_valid = <span class="keyword">true</span>;</div><div class="line"><a name="l00104"></a><span class="lineno">  104</span>&#160;</div><div class="line"><a name="l00105"></a><span class="lineno">  105</span>&#160;    <span class="keywordflow">for</span>(<span class="keyword">const</span> <span class="keyword">auto</span> &amp;option : _options)</div><div class="line"><a name="l00106"></a><span class="lineno">  106</span>&#160;    {</div><div class="line"><a name="l00107"></a><span class="lineno">  107</span>&#160;        <span class="keywordflow">if</span>(option.second-&gt;is_required() &amp;&amp; !option.second-&gt;is_set())</div><div class="line"><a name="l00108"></a><span class="lineno">  108</span>&#160;        {</div><div class="line"><a name="l00109"></a><span class="lineno">  109</span>&#160;            is_valid = <span class="keyword">false</span>;</div><div class="line"><a name="l00110"></a><span class="lineno">  110</span>&#160;            std::cerr &lt;&lt; <span class="stringliteral">&quot;ERROR: Option &#39;&quot;</span> &lt;&lt; option.second-&gt;name() &lt;&lt; <span class="stringliteral">&quot;&#39; is required but not given!\n&quot;</span>;</div><div class="line"><a name="l00111"></a><span class="lineno">  111</span>&#160;        }</div><div class="line"><a name="l00112"></a><span class="lineno">  112</span>&#160;    }</div><div class="line"><a name="l00113"></a><span class="lineno">  113</span>&#160;</div><div class="line"><a name="l00114"></a><span class="lineno">  114</span>&#160;    <span class="keywordflow">for</span>(<span class="keyword">const</span> <span class="keyword">auto</span> &amp;option : _positional_options)</div><div class="line"><a name="l00115"></a><span class="lineno">  115</span>&#160;    {</div><div class="line"><a name="l00116"></a><span class="lineno">  116</span>&#160;        <span class="keywordflow">if</span>(option-&gt;is_required() &amp;&amp; !option-&gt;is_set())</div><div class="line"><a name="l00117"></a><span class="lineno">  117</span>&#160;        {</div><div class="line"><a name="l00118"></a><span class="lineno">  118</span>&#160;            is_valid = <span class="keyword">false</span>;</div><div class="line"><a name="l00119"></a><span class="lineno">  119</span>&#160;            std::cerr &lt;&lt; <span class="stringliteral">&quot;ERROR: Option &#39;&quot;</span> &lt;&lt; option-&gt;name() &lt;&lt; <span class="stringliteral">&quot;&#39; is required but not given!\n&quot;</span>;</div><div class="line"><a name="l00120"></a><span class="lineno">  120</span>&#160;        }</div><div class="line"><a name="l00121"></a><span class="lineno">  121</span>&#160;    }</div><div class="line"><a name="l00122"></a><span class="lineno">  122</span>&#160;</div><div class="line"><a name="l00123"></a><span class="lineno">  123</span>&#160;    <span class="keywordflow">for</span>(<span class="keyword">const</span> <span class="keyword">auto</span> &amp;option : _unknown_options)</div><div class="line"><a name="l00124"></a><span class="lineno">  124</span>&#160;    {</div><div class="line"><a name="l00125"></a><span class="lineno">  125</span>&#160;        std::cerr &lt;&lt; <span class="stringliteral">&quot;WARNING: Skipping unknown option &#39;&quot;</span> &lt;&lt; option &lt;&lt; <span class="stringliteral">&quot;&#39;!\n&quot;</span>;</div><div class="line"><a name="l00126"></a><span class="lineno">  126</span>&#160;    }</div><div class="line"><a name="l00127"></a><span class="lineno">  127</span>&#160;</div><div class="line"><a name="l00128"></a><span class="lineno">  128</span>&#160;    <span class="keywordflow">for</span>(<span class="keyword">const</span> <span class="keyword">auto</span> &amp;option : _invalid_options)</div><div class="line"><a name="l00129"></a><span class="lineno">  129</span>&#160;    {</div><div class="line"><a name="l00130"></a><span class="lineno">  130</span>&#160;        std::cerr &lt;&lt; <span class="stringliteral">&quot;WARNING: Skipping invalid option &#39;&quot;</span> &lt;&lt; option &lt;&lt; <span class="stringliteral">&quot;&#39;!\n&quot;</span>;</div><div class="line"><a name="l00131"></a><span class="lineno">  131</span>&#160;    }</div><div class="line"><a name="l00132"></a><span class="lineno">  132</span>&#160;</div><div class="line"><a name="l00133"></a><span class="lineno">  133</span>&#160;    <span class="keywordflow">return</span> is_valid;</div><div class="line"><a name="l00134"></a><span class="lineno">  134</span>&#160;}</div></div><!-- fragment -->
</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li>tests/framework/command_line/<a class="el" href="_command_line_parser_8h_source.xhtml">CommandLineParser.h</a></li>
<li>tests/framework/command_line/<a class="el" href="_command_line_parser_8cpp_source.xhtml">CommandLineParser.cpp</a></li>
</ul>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="namespacearm__compute.xhtml">arm_compute</a></li><li class="navelem"><a class="el" href="namespacearm__compute_1_1test.xhtml">test</a></li><li class="navelem"><a class="el" href="namespacearm__compute_1_1test_1_1framework.xhtml">framework</a></li><li class="navelem"><a class="el" href="classarm__compute_1_1test_1_1framework_1_1_command_line_parser.xhtml">CommandLineParser</a></li>
    <li class="footer">Generated on Wed May 23 2018 11:36:44 for Compute Library by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.11 </li>
  </ul>
</div>
</body>
</html>
